package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.RolePermission;
import com.woniu.finance.service.IRolePermissionService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 角色权限表 前端控制器
 * </p>
 *
 * @author 杨鹏
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/finance/role-permission")
public class RolePermissionController {

    @Autowired
    private IRolePermissionService rolePermissionService;

    @PostMapping("/saveRolePermission")
    @OperationLogAnnotation(operModul = "融资企业-角色权限表",operType = "新增",operDesc = "新增角色权限表")//操作日志注解
    public HttpResult<?> saveRolePermission(@RequestBody RolePermission rolePermission){
        return rolePermissionService.saveRolePermission(rolePermission);
    }

    @RequestMapping("/removeRolePermission")
    @OperationLogAnnotation(operModul = "融资企业-角色权限表",operType = "删除",operDesc = "删除角色权限表")//操作日志注解
    public HttpResult<?> removeRolePermission(Integer id){
        return rolePermissionService.removeRolePermission(id);
    }

    @PostMapping("/modifyRolePermission")
    @OperationLogAnnotation(operModul = "融资企业-角色权限表",operType = "修改",operDesc = "修改角色权限表")//操作日志注解
    public HttpResult<?> modifyRolePermission(@RequestBody RolePermission rolePermission){
        return rolePermissionService.modifyRolePermission(rolePermission);
    }

    @RequestMapping("/findAllRolePermission")
    @OperationLogAnnotation(operModul = "融资企业-角色权限表",operType = "查询",operDesc = "查询所有角色权限表")//操作日志注解
    public HttpResult<?> findAllRolePermission(){
        return rolePermissionService.findAllRolePermission();
    }

    @RequestMapping("/findAllRolePermissionById")
    @OperationLogAnnotation(operModul = "融资企业-角色权限表",operType = "查询",operDesc = "根据id查询角色权限表")//操作日志注解
    public HttpResult<?> findAllRolePermissionById(Integer id){
        return rolePermissionService.findAllRolePermissionById(id);
    }
}
